Make cconv-analyse understand the need for closures.
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 11 Feb 2011 19:48:54 +0000 (14:48 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 11 Feb 2011 19:48:54 +0000 (14:48 -0500)
commit8a9e49c0225bdcd41f3b84e6c24365a2311062e7
tree6b27d7af797cae1a479aabfdca2facb91630856b
parent02ec3f8c46411ce800ae2ba8f9e12a15b591f6f1
Make cconv-analyse understand the need for closures.
* lisp/emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
Understand the :fun-body case for catch, save-window-excursion, and
condition-case.
(byte-compile-maybe-push-heap-environment): No need when nclosures is
zero and byte-compile-current-num-closures is -1.

* lisp/emacs-lisp/bytecomp.el (byte-compile-lambda): Fix `fun' that was not
renamed to `bytecomp-fun'.

* lisp/emacs-lisp/cconv.el (cconv-not-lexical-var-p): New function.
(cconv-freevars): Use it.
(cconv-closure-convert-rec): Avoid `position'.
(cconv-analyse-function): New function.
(cconv-analyse-form): Use it.  `inclosure' can't be nil any more.
Check lexical vars at let-binding time rather than when referenced.
For defuns to be in an empty environment and lambdas to take lexical args.
Pay attention to the need to build closures in catch, unwind-protect,
save-window-excursion, condition-case, and track-mouse.
Fix defconst/defvar handling.
lisp/ChangeLog
lisp/emacs-lisp/byte-lexbind.el
lisp/emacs-lisp/bytecomp.el
lisp/emacs-lisp/cconv.el
lisp/emacs-lisp/macroexp.el